# -*- coding: utf-8 -*-
# @Time    : 2021/5/17 16:14
# @Author  : yejing
# @Email   : 458663810@qq.com
# @File    : 作业：回合制对战游戏.py
# @Software: PyCharm

class Users():
    blood = 100
    def __init__(self,name,sex,equipment):
        # self.blood = blood
        self.name = name
        self.sex = sex
        self.equipment = equipment
    def attach(self,user):
        print(f"{self.name}攻击了{user.name}")
        if user.equipment == "防弹衣":
            # hurted = 5
            user.blood -= 5
            print(f"{user.name}还剩{user.blood}血")
            # return self.blood
        elif user.equipment == " ":
            # hurted = 10
            user.blood -= 10
            # return self.blood
            print(f"{user.name}还剩{user.blood}血")
        # self.blood -= hurted

class Rooms():
    def __init__(self,name):
        self.name = name
        self.name_list = []
    def add_room(self,username):
        if len(self.name_list) < 2:
            if username in self.name_list:
                print("您已经在房间内")
            else:
                self.name_list.append(self.name)
                print("欢迎加入！")
        else:
            print("房间人数已满")

user1 = Users("yezi","male","防弹衣")
user2 = Users("xie","man"," ")
room = Rooms("房间一")


while 1:
    if user1.blood <= 0:
        print(f"{user1.name}被打败")
        break
    elif user2.blood<= 0:
        print(f"{user2.name}被打败")
        break
    user1.attach(user2)
    user2.attach(user1)




